import org.springframework.context.ApplicationContext;

import app.dev.telemetric.dao.DataMapper;
import app.dev.telemetric.model.Data;
import app.dev.telemetric.model.DataKey;


public class consultor extends Thread {
	DataMapper dMapper;
	
	public consultor(ApplicationContext ac)
	{
		dMapper=ac.getBean("dataMapper", DataMapper.class);
	}
	
	public void run()
	{
		DataKey dk=new DataKey();
		long uno=new Long(1);
		Data d;
		long time;
		
		for(int i=0; i<1000; i++)
		{	
			dk.setIdApplication(uno);
			dk.setIdDevice(uno);
			dk.setIdProtocol(uno);
			dk.setIdSignal(uno);
			dk.setPsSequence(new Integer(1));
			dk.setTimestampMl(uno);
			time=System.currentTimeMillis();
			d=dMapper.selectByPrimaryKey(dk);
			time=System.currentTimeMillis()-time;
			System.out.println(time);
			if(d!=null)
				System.out.println("Encontrado");
		}
	}

}
